package com.leo.simple.job;

import com.leo.bean.Student;
import org.quartz.*;

import java.time.LocalDateTime;

/**
 * @ClassName StudentJob
 * @Description dateMap 中的数据有自动注入功能
 * @Author wangss
 * @date 2021.07.14 20:46
 * @Version 1.0
 */
public class StudentJob implements Job {

    private Student student;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        JobKey key = jobExecutionContext.getJobDetail().getKey();
        JobDataMap dataMap = jobExecutionContext.getMergedJobDataMap();

        System.out.println("job = [" + key + "], student = [" + student.toString() + "], date = [" + LocalDateTime.now() + "]");
    }

    public void setStudent(Student student) {
        this.student = student;
    }
}
